#!/bin/sh

Container="myblog"

case "$1" in
build)
  sudo rm -rf target
  sudo cp ./conf.d/myblog.conf /home/ubuntu/proj/nginx-center/conf.d/myblog.conf
  sudo cp -r ../myblog-front/dist /home/ubuntu/proj/nginx-center/html/myblog-front
  ;;
start)
  nohup sudo docker-compose up >myblog.log 2>&1 &
  tail -f myblog.log
  ;;
stop)
  sudo docker-compose down
  ;;
login)
  docker exec -it $Container /bin/bash
  ;;
info)
  docker ps -a -f name=$Container
  ;;
port)
  docker port $Container
  ;;
*)
  echo "Usage: build|run|init[chmod,conf]|start|stop|remove|login|info|port"
  exit 3
  ;;
esac
